<?php require_once('Connections/MYCONN.php'); ?>

<?php
//
$sSQL ="SELECT * FROM tb_cashlog WHERE ID = ".base64_decode($_GET["ID"]);
$sSP ="CALL sp_register_master( 0, ".base64_decode($_GET["ID"]).")";

$sSQL2 ="SELECT sum(DiffAmt) as depChek FROM tb_cashlog_dep_check WHERE ParentID = ".base64_decode($_GET["ID"]);
$sSP2 ="CALL sp_register_master_check_deposits(".base64_decode($_GET["ID"]).")";

mysql_select_db($database_MYCONN, $MYCONN);
$Result2 = mysql_query($sSP, $MYCONN) or die(mysql_error());

$Result1 = mysql_query($sSQL, $MYCONN) or die(mysql_error());

$Result21 = mysql_query($sSP2, $MYCONN) or die(mysql_error());

$Result22 = mysql_query($sSQL2, $MYCONN) or die(mysql_error());

$rows = mysql_fetch_assoc($Result1);
$rows2 = mysql_fetch_assoc($Result22);

$div1 = "<div id='shortover' style='border:thick #00DFAA dotted; background-color:#8FB19D; text-align:center; line-height:1.25'>";
$div2 = "<div id='shortover' style='border:thick #FF5F00 dotted; background-color:yellow; text-align:center; line-height:1.25'>";
$div_end = "</div>";
$b = "<b>";
$br = "<br>";
$b_end = "</b>";
$and = "<br>&amp;";
$log_bad = "Log is not verified please double check and correct the data. If you need help call Max.";
$log_good = "Log is verified and good.";
$dep_bad = "<b><font color='red'>Please check Cash $100, $50, $20 and deposit $100, $50, $20, they should match.</font></b>";
$dep_good="Cash and deposits verified and good.";

$str_txt="";

do{

	if ( $rows['Verified']==1 && abs($rows['ShortOver']) < 11 ){
		$str_txt = $str_txt.$div1;
	}else{
		$str_txt = $str_txt.$div2;
	}
	
	$str_txt = $str_txt.$b;

	if($rows['Verified']==0){
		$str_txt = $str_txt.$log_bad.$and;
	}else{
		$str_txt = $str_txt.$log_good;
	}
	
	$str_txt = $str_txt.$b_end;
}while ($rows = mysql_fetch_assoc($Result1));


do{
	$str_txt = $str_txt.$br;

	if(abs($rows2['depChek']) > 0){
		$str_txt = $str_txt.$dep_bad;
	}else{
		$str_txt = $str_txt.$dep_good;
	}

	$str_txt = $str_txt.$div_end;
	
}while ($rows2 = mysql_fetch_assoc($Result22));


mysql_free_result($Result1);
mysql_free_result($Result22);


echo $str_txt;

?>